//
//  ToBeReviewedTaskDetailCell.m
//  MyProject
//
//  Created by Pei on 16/7/30.
//  Copyright © 2016年 Xiaobo Pei. All rights reserved.
//

#import "ToBeReviewedTaskDetailCell.h"

@implementation ToBeReviewedTaskDetailCell
{
    UILabel *itemDetailLbl;
    UILabel *checkDetailLbl;
    UILabel *koufenDetailLbl;
    
    UILabel *resultDetailLbl;
    
    UILabel *riskDetailLbl;
}

@synthesize checkItemControl, seeBtn, passBtn, refuseBtn;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = kWhiteColor;
        
        //_footView = [[UIView alloc] init];
        //_footView.frame = CGRectMake(0.0f, 0.0f, kDeviceWidth, 54.0f*4.0+10.0f);
        //_footView.backgroundColor = kWhiteColor;
        
        UIView *topView = [[UIView alloc] init];
        topView.frame = CGRectMake(0.0f, 0.0f, kDeviceWidth, 10.0f);
        topView.backgroundColor = kDefaultBackgroundColor;
        [self addSubview:topView];
        
       // _footView = [[UIView alloc] init];
       // _footView.frame = CGRectMake(0.0f, 0.0f, kDeviceWidth, 54.0f*4.0+10.0f);
       // _footView.backgroundColor = kWhiteColor;
        
    
        
        checkItemControl = [[UIControl alloc] init];
        checkItemControl.frame = CGRectMake(0.0f, topView.bottom, kDeviceWidth, 54.0f);
        [self addSubview:checkItemControl];
        
        UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"02jiantou-"]];
        arrowImageView.frame = CGRectMake(kDeviceWidth-16.0f-10.0f/2.0f, (54.0f-19.0f/2.0f)/2.0f, 10.0f/2.0f, 19.0f/2.0f);
        [checkItemControl addSubview:arrowImageView];
        
        UILabel *checkLbl = [[UILabel alloc] init];
        checkLbl.frame = CGRectMake(16.0f, (54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        checkLbl.font = kAppFont(Home_Small_Size+2);
        checkLbl.textColor = kRGB(205, 206, 207);
        checkLbl.text = @"检查内容：";
        [checkItemControl addSubview:checkLbl];
        
        checkDetailLbl = [[UILabel alloc] init];
        checkDetailLbl.frame = CGRectMake(checkLbl.right, (54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-checkLbl.width-arrowImageView.width-16.0f, Home_Small_Size);
        checkDetailLbl.font = kAppFont(Home_Small_Size);
        checkDetailLbl.textColor = kRGB(100, 99, 104);
        checkDetailLbl.text = @"检查内容：";
        [checkItemControl addSubview:checkDetailLbl];
        
        UIView *lineView0 = [[UIView alloc] init];
        lineView0.frame = CGRectMake(16.0f, 53.5f, kDeviceWidth-16.0f, 0.5f);
        lineView0.backgroundColor = kGreenColor;
        [checkItemControl addSubview:lineView0];
        
        UILabel *itemLbl = [[UILabel alloc] init];
        itemLbl.frame = CGRectMake(16.0f, checkItemControl.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        itemLbl.font = kAppFont(Home_Small_Size+2);
        itemLbl.textColor = kRGB(205, 206, 207);
        itemLbl.text = @"检查描述：";
        [self addSubview:itemLbl];
        
        itemDetailLbl = [[UILabel alloc] init];
        itemDetailLbl.frame = CGRectMake(checkLbl.right, checkItemControl.bottom+(54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-checkLbl.width-16.0f, Home_Small_Size);
        itemDetailLbl.font = kAppFont(Home_Small_Size);
        itemDetailLbl.textColor = kRGB(100, 99, 104);
        itemDetailLbl.text = @"检查内容：";
        [self addSubview:itemDetailLbl];
        
        UIView *lineView1 = [[UIView alloc] init];
        lineView1.frame = CGRectMake(16.0f, 54.0f*2.0f+10.0f-0.5f, kDeviceWidth-16.0f, 0.5f);
        lineView1.backgroundColor = kGreenColor;
        [self addSubview:lineView1];
        
        
        UILabel *riskLbl = [[UILabel alloc] init];
        riskLbl.frame = CGRectMake(16.0f, lineView1.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        riskLbl.font = kAppFont(Home_Small_Size+2);
        riskLbl.textColor = kRGB(205, 206, 207);
        riskLbl.text = @"隐患类型：";
        [self addSubview:riskLbl];
        
        riskDetailLbl = [[UILabel alloc] init];
        riskDetailLbl.frame = CGRectMake(riskLbl.right, lineView1.bottom+(54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-riskLbl.width-16.0f, Home_Small_Size);
        riskDetailLbl.font = kAppFont(Home_Small_Size);
        riskDetailLbl.textColor = kRGB(100, 99, 104);
        riskDetailLbl.text = @"";
        [self addSubview:riskDetailLbl];
        
        UIView *lineView11 = [[UIView alloc] init];
        lineView11.frame = CGRectMake(16.0f, 54.0f*3.0f+10.0f-0.5f, kDeviceWidth-16.0f, 0.5f);
        lineView11.backgroundColor = kGreenColor;
        [self addSubview:lineView11];
        
        
        UILabel *koufenLbl = [[UILabel alloc] init];
        koufenLbl.frame = CGRectMake(16.0f, lineView11.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 45, Home_Small_Size+2);
        koufenLbl.font = kAppFont(Home_Small_Size+2);
        koufenLbl.textColor = kRGB(205, 206, 207);
        koufenLbl.text = @"扣分：";
        [self addSubview:koufenLbl];
        
        koufenDetailLbl = [[UILabel alloc] init];
        koufenDetailLbl.frame = CGRectMake(koufenLbl.right, lineView11.bottom+(54.0f-(Home_Small_Size))/2.0f, 40, Home_Small_Size);
        koufenDetailLbl.font = kAppFont(Home_Small_Size);
        koufenDetailLbl.textColor = kRGB(25, 151, 198);
        koufenDetailLbl.text = @"6";
        [self addSubview:koufenDetailLbl];
        
        UILabel *resultLbl = [[UILabel alloc] init];
        resultLbl.frame = CGRectMake(koufenDetailLbl.right, lineView11.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        resultLbl.font = kAppFont(Home_Small_Size+2);
        resultLbl.textColor = kRGB(205, 206, 207);
        resultLbl.text = @"审核结果：";
        [self addSubview:resultLbl];
        
        resultDetailLbl = [[UILabel alloc] init];
        resultDetailLbl.frame = CGRectMake(resultLbl.right, lineView11.bottom+(54.0f-(Home_Small_Size))/2.0f, 70.0f, Home_Small_Size);
        resultDetailLbl.font = kAppFont(Home_Small_Size);
        resultDetailLbl.textColor = kRGB(25, 151, 198);
        resultDetailLbl.text = @"待整改";
        [self addSubview:resultDetailLbl];
        
        UIView *lineView2 = [[UIView alloc] init];
        lineView2.frame = CGRectMake(16.0f, 54.0f*4.0f+10.0f-0.5f, kDeviceWidth-16.0f, 0.5f);
        lineView2.backgroundColor = kGreenColor;
        [self addSubview:lineView2];
        
        seeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        seeBtn.frame = CGRectMake(16.0f, lineView2.bottom+(54.0f-40.0f)/2.0f, (kDeviceWidth-16*4)/3.0f, 40.0f);
        [seeBtn setBackgroundColor:kRGB(113, 122, 162)];
        [seeBtn setTitle:@"查看" forState:UIControlStateNormal];
        seeBtn.layer.cornerRadius = 5.0f;
        seeBtn.layer.masksToBounds = YES;
        //seeBtn.tag = 116;
        //[seeBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:seeBtn];
        
        passBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        passBtn.frame = CGRectMake(seeBtn.right+16.0f, lineView2.bottom+(54.0f-40.0f)/2.0f, (kDeviceWidth-16*4)/3.0f, 40.0f);
        [passBtn setBackgroundColor:kBlueColor];
        [passBtn setTitle:@"通过" forState:UIControlStateNormal];
        passBtn.layer.cornerRadius = 5.0f;
        passBtn.layer.masksToBounds = YES;
        //passBtn.tag = 118;
        //[passBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:passBtn];
        
        
        refuseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        refuseBtn.frame = CGRectMake(passBtn.right+16.0f, lineView2.bottom+(54.0f-40.0f)/2.0f, (kDeviceWidth-16*4)/3.0f, 40.0f);
        [refuseBtn setBackgroundColor:kRedColor];
        [refuseBtn setTitle:@"拒绝" forState:UIControlStateNormal];
        refuseBtn.layer.cornerRadius = 5.0f;
        refuseBtn.layer.masksToBounds = YES;
        //refuseBtn.tag = 119;
        //[refuseBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:refuseBtn];
        
    }
    
    return self;
}
- (void)showWithData:(NSDictionary*)data{
    koufenDetailLbl.text = [NSString stringWithFormat:@"%d", [[data valueForKey:@"Points"] intValue]];
    checkDetailLbl.text = [data valueForKey:@"InspectContentDesc"];
    itemDetailLbl.text = [data valueForKey:@"InspectRiskDesc"];
    
    NSArray *arrayYYY = [[NSUserDefaults standardUserDefaults] objectForKey:Dic_RepairRecordState];
    if (arrayYYY != nil && arrayYYY.count > 0) {
        for (NSDictionary *dddd in arrayYYY) {
            if ([[dddd valueForKey:@"Value"] intValue] == [[data valueForKey:@"InspectContentStatus"] intValue]) {
                resultDetailLbl.text = [dddd valueForKey:@"Name"];
            }
        }
    }
    
    
    
    riskDetailLbl.text = [data valueForKey:@"RiskTypeName"];
}
@end
